﻿using System;
using System.Collections.Generic;

namespace Battle.Engine.InputData
{
    public class InFightData
    {
        public string fightId;
        public BattleType battleType;
        public bool attackFirst;//攻方先手
        public int maxRoundCount;//最大回合数(1-N)
        public long seed;//随机种子
        public InPlayerData attacker;
        public InPlayerData defender;

        public bool recordAttackerOperate = false;      //是否保存进攻方的操作记录
        public bool recordDefenderOperate = false;      

        public InFightData() { }

        public static InFightData BuildInFightData(BattleData battleData, BattleFighterData attacker, BattleFighterData defender) {
            InFightData data = new InFightData();
            data.fightId = battleData.fightId;
            data.battleType = battleData.battleType;
            data.attackFirst = battleData.attackFirst;
            data.maxRoundCount = battleData.maxRound;
            data.seed = battleData.randomSeed;
            data.attacker = new InPlayerData(attacker);
            data.defender = new InPlayerData(defender);
            if (battleData.battleType == BattleType.PVE 
                || battleData.battleType == BattleType.WANTED
                || battleData.battleType == BattleType.ACTIVITY
                || battleData.battleType == BattleType.RUSH 
                || battleData.battleType == BattleType.WANTED
                || battleData.battleType == BattleType.RUSH_BOSS
                || battleData.battleType == BattleType.FIELD_PVE
                || battleData.battleType == BattleType.FIELD_BOSS)
            {
                data.recordAttackerOperate = true;
                data.recordDefenderOperate = false;
            }
            else {
                data.recordAttackerOperate = false;
                data.recordDefenderOperate = false;
            }

            return data;
        }
    }
}
